CPE 332
Computer Engineering
Mathematics II
Part III,
Chapter 12 ODE
• Chapter 12 Ordinary Differential Equation
– HW 10 Due Today
– HW 11 Due Wed 4 May, 12.00 Noon
• ส่งห้องเลขาภาค
• Course Ends This Week
– No Chapter 13(Curve Fitting)
• เป็นสมการทางคณิตศาสตร์ ที่ประกอบด ้วย
Derivative (หรือ Integral)
– Solution ของสมการคือ Function ที่ไม่มี Derivative หรือ Integral ปรากฏอยู่
• รูปแบบทั่วไปคือ (First Order)
– dy/dx = f(x,y)
– กรณีพิเศษที่ dy/dx = f(x) เราสามารถแก ้สมการโดย
ใช ้การ Integrate
• dy = f(x)dx
• y = ∫ f(x)dx = F(x) + C : ค่า C สามารถหาได ้โดยการกําหนด
Initial condition
– ปกติการแก ้สมการทั่วไปไม่สามารถใช ้ Integrate ได ้
• Solve for dy = 3 2 x; x = ,2 y = 4
dx
• Solve for dy = 3 2 x; x = ,2 y = 4
dx
dy = 3 2
x dx
y = 3 2
x dx
∫
3
y = x + C (
General So
lution)
• Solve for dy = 3 2 x; x = ,2 y = 4
dx
dy = 3 2
x dx
y = 3 2
∫ x dx
3
y = x + C (
General So
lution)
x = 2, y = 4
4 = 23 + C
C = 4
−
3
y = x − 4
• ค่า Order สูงสุดของ Derivative จะ
กําหนด Order ของ Differential
Equation
– จํานวน Initial Condition ที่จะต ้องใช ้จะ
เท่ากับค่าของ Order ของสมการ
d
F ( x, y) : 3
xy + 2
2
y + x = 4
Fin
d f ( x, y) =
F ( x, y)
dx
d
d
3
xy + 2
2
y + x =
4
dx
dx
d
dx
dy
dx
[
3
3
x
y + y
] + 2
+ 2 x
= 0
dx
dx
dx
dx
dy
dy
3
[
2
3
xy
+ y ]+ 2
+ 2 x = 0
dx
dx
dy
dy
3
2
xy
+ 2
= 2
3
− x − y
dx
dx
dy 3
[
2
xy + 2] = 2
3
− x − y
dx
dy
− 2
3
x −
=
y
dx
3
[
2
xy + ]
2
3
• แก ้สมการ dy
− 2 x −
=
y
f ( x, y) =
dx
3
[
2
xy + 2]
− 2 x − 3
dy =
y dx
3
[ xy 2 + 2]
2
3
y = ∫ − x − y dx 3
[ xy 2 + ]
2
Integrate ไม่ได ้
• Tools ทางคณิตศาสตร์ที่สําคัญสําหรับใช ้ใน
การแก ้ปัญหา Differential Equation
– Laplace Transform (one side/two side)
– Fourier Transform ใช ้ได ้เช่นกัน
– Z-Transform ใช ้สําหรับแก ้ปัญหา Discrete Version ของ Differential Equation
• คือ Differential Equation ที่ได ้จากการสุ่ม
ตัวอย่างของตัวแปร
• กรณีนี้เราเรียก Difference Equation
– ทั้งหมดนี้อยู่ในเนื้อหาวิชา CPE 308
• บทนี้เราจะมาดู Numerical Method
สําหรับใช ้ในการแก ้สมการ Differential Equation
– เราจะจํากัดอยู่ที่ First Order และ Initial Condition ที่จุดตั้งต ้น
– เป็นสมการของ Ordinary Differential Equation
• One Independent Variable
– สามารถดัดแปลงสําหรับ Higher Order ได ้
– กรณีที่เป็น Boundary Condition จะต ้องใช ้วิธี
อื่น
• ศึกษาเพิ่มเติมได ้จาก Reference
Chapter 10
• Ordinary Differential Equation
ODE
ODE
ODE
ODE: One Step Method
y
y 4
3
y 1
y
y
2
0
x
h
0
x
x
x
x
x
0
1
2
3
4
ODE: One Step Method
Euler’s Method
Euler’s Method
Euler’s Method
Euler’s Method
Euler’s Method
Euler’s Method
Heun and Polygon Method
Heun Method
Heun Method
Heun Method
Heun and Polygon Method
Heun Method
Heun and Polygon Method
Heun Method
Heun Method
Improved Polygon Method
Improved Polygon Method
Runge-Kutta Method
Runge-Kutta Method
Second Order Runge-Kutta
Method
Second Order Runge-Kutta
Method
Second Order Runge-Kutta
Method
Second Order Runge-Kutta
Method
Second Order Runge-Kutta
Method
Second Order Runge-Kutta
Method
Second Order Runge-Kutta
Method
Second Order Runge-Kutta
Method
Second Order Runge-Kutta
Method
Third Order Runge-Kutta
Method
Third Order Runge-Kutta
Method
Forth Order Runge-Kutta
Method
Forth Order Runge-Kutta
Method
Higher Order Runge-Kutta
Method
Comparison
• Download HW 11(ODE)และทําใน
Sheet
– Option ถ้าใครส่งครบ 10 ครั้งและได้เต็ม
ไม่ต้องส่ง
– จะนับ 10 HW ที่คะแนนมากที่สุด
– ส่งพุธที่ 4 พ.ค. ที่ห้องภาค 5-310 ก่อน
เที่ยง
• ไม่มีบทที่ 13 Curve Fitting
• Course Ends
• สูตรจะให้มา
• ข้อสอบมี 7 ข้อ เลือกทํา 5 ข้อ 10x5 =
50 คะแนน เทียบเป็นคะแนนเก็บ 50%
• 2 ข้อ เป็นเรื่องก่อน Midterm (Part 1
หนึ่งข้อ และ Part 2 หนึ่งข้อ)
• 5 ข้อเป็นเรื่องใหม่ ด ังน้ี
• 5 ข้อ เป็นเรื่องใหม่ หล ัง MT ด ังนี้
– 1. Taylor Series และการประมาณค่าของ
Function รวมถึง Error
– 2. Root of Function (Bisection หรือ
Newton)
– 3. Linear Equation 1 ข ้อ
• Gauss Elimination, Gauss Jordan, Gauss Seidel และ LU Decompositon
– 4. Numerical Integration (Trapezoidal หรือ
Simpson)
– 5. ODE โดยใช ้ 4th Order RK
Formulas
ઙ્ગહ્ણહ્વ� MT+ઙ્ઘ�
�����